package com.xh.petdogexpert.base;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

public class ResponseData {
	
	public boolean success = true;
	
	@JsonInclude(Include.NON_NULL)
	public String msg;//成功的返回信息
	
	@JsonInclude(Include.NON_NULL)
	public Integer status;
	
	public Object data;
	
	@JsonInclude(Include.NON_NULL)
	public Integer errorType;
	
	@JsonInclude(Include.NON_NULL)
	public Object error;//失败的返回信息
	
	public ResponseData() {
	}
	
	public ResponseData(Object data) {
		this.data = data;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
	
	public void setError(Object error) {
		this.error = error;
	}
	
	public Object getError() {
		return error;
	}
	
	public void setErrorType(Integer errorType) {
		this.errorType = errorType;
	}
	
	public Integer getErrorType() {
		return errorType;
	}
	
	public void wrapBaseException(BaseException e) {
		if(e.getErrorMsg() != null) 
			success = false;
		setError(e.getErrorMsg());
		setErrorType(e.getErrorType());
	}
}
